package com.example.springconfigfile.controller;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/yml")
public class YmlController {
    @Value("${string.value}")
    private String string;
    @Value("${boolean.value1}")
    private boolean bool1;
    @Value("${boolean.value2}")
    private boolean bool2;
    @Value("${int.value}")
    private Integer integer;
    @Value("${null.value}")
    private String nullValue;
    @Value("${empty.value}")
    private String emptyValue;
    @Value("${string.str1}")
    private String str1;
    @Value("${string.str2}")
    private String str2;
    @Value("${string.str3}")
    private String str3;

    @ResponseBody
    @RequestMapping("/string")
    public String string() {
        return "String: " + string;
    }

    @ResponseBody
    @RequestMapping("/bool")
    public String bool() {
        return "bool1: " + bool1 + "\n" + "bool2: " + bool2;
    }

    @ResponseBody
    @RequestMapping("/int")
    public String integer() {
        return "integer: " + integer;
    }

    @ResponseBody
    @RequestMapping("/null")
    public String getNull() {
        return "null: " + nullValue;
    }

    @ResponseBody
    @RequestMapping("/empty")
    public String empty() {
        return "empty: " + emptyValue;
    }

    @ResponseBody
    @RequestMapping("/str")
    public String str() {
        System.out.println(str1);
        System.out.println(str2);
        System.out.println(str3);
        return "yml";
    }
}
